﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Models;

namespace Providers
{
    /// <summary>
    /// Interface to a query provider
    /// </summary>
    public interface IQueryProvider
    {
        /// <summary>
        /// Save data to a text file
        /// </summary>
        /// <param name="fileName">The name of the file to save the data to</param>
        /// <param name="dataToSave">The data to save</param>
        /// <param name="errorMsg">Any error messages generated during the save process</param>
        /// <returns>True if the save was successfull, otherwise false</returns>
        bool SaveText(string fileName, string dataToSave, out string errorMsg);

        /// <summary>
        /// Save data to a text file which has a number embedded in it
        /// </summary>
        /// <param name="fileName">The name of the file to save the data to</param>
        /// <param name="fileNum">A number to include in the file name (so data.txt would become data 1.txt)</param>
        /// <param name="dataToSave">The data to save</param>
        /// <param name="errorMsg">Any error messages generated during the save process</param>
        /// <returns>True if the save was successfull, otherwise false</returns>
        bool SaveNumberedText(string fileName, int fileNum, string dataToSave, out string errorMsg);

        /// <summary>
        /// Load a text file and return the contents
        /// </summary>
        /// <param name="fileName">The name of the file to load</param>
        /// <param name="errorMsg">Any error messages generated during the load process</param>
        /// <returns>If successfull then the data loaded from the file, otherwise string.Empty</returns>
        string LoadText(string fileName, out string errorMsg);

        /// <summary>
        /// Add the databases server and database name to the base file name
        /// </summary>
        /// <param name="baseFileName">The base file name</param>
        /// <param name="db">The database whose details we want to add to the base file name</param>
        /// <returns>The file name in the format [Base Filename] [Server Name] [Database Name]</returns>
        string GetDatabaseServerFileName(string baseFileName, Models.Database db);
    }
}
